﻿using System.ComponentModel;
using System.Collections.ObjectModel;

namespace TopBuilds.Restaurant.ViewModel.Notify
{
    public class Department : TopBuilds.Restaurant.Data.Department, INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        public Department()
        { 
        }
        
        public Department(string name)
            :base(name)
        {
        }

        public Department(TopBuilds.Restaurant.Data.Department department)
        {
            base.Id = department.Id;
            base.Name = department.Name;
        }


        public override string ToString()
        {
            return base.Name;
        }

        public int Id
        {
            get { return base.Id; }
            set
            {
                base.Id = value;
                OnPropertyChanged( TopBuilds.Restaurant.Data.DepartmentDesc.Id );
            }
        }

        public string Name
        {
            get { return base.Name; }
            set
            {
                base.Name = value;
                OnPropertyChanged( TopBuilds.Restaurant.Data.DepartmentDesc.Name );
            }
        }

        protected void OnPropertyChanged(string info)
        {
            PropertyChangedEventHandler handler = PropertyChanged;

            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(info));
            }
        }
    }
}
